package cn.iocoder.yudao.module.trade.enums.orderpostback;

import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Arrays;

@RequiredArgsConstructor
@Getter
public enum OrderPostBackConfigTypesEnum implements IntArrayValuable {

    PERCENT(1, "百分比"),
    LESS_THEN(2, "小于"),
    MORE_THEN(3, "大于");

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(OrderPostBackConfigTypesEnum::getType).toArray();
    /**
     * 类型
     */
    private final Integer type;
    /**
     * 类型名
     */
    private final String name;

    public static OrderPostBackConfigTypesEnum getByType(Integer type) {
        return Arrays.stream(values()).filter(item -> item.getType().equals(type)).findFirst().orElse(null);
    }


    @Override
    public int[] array() {
        return ARRAYS;
    }
}
